#include "processbar.h"

char proc[NUM] = "\0";
char process[5] = "|/-\\";

void processBar(int rate){
    if(rate == 0)
        return;
    proc[rate-1] = SIGNAL; 
    int pos = rate % 4;
    printf("\r[%-100s][%d%%][%c]",proc,rate,process[pos]);
    fflush(stdout);
    usleep(100000); 
}

void init(){
    memset(proc,0,'\0');
}
